<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/24/024
 * Time: 20:12
 */

namespace app\admin\validate;

class RoleValidate extends \think\Validate
{

    const SCENE_ADD = 'add'; //添加权限
    const SCENE_REMOVE = 'remove'; //删除权限
    const SCENE_MODIFY = 'modify'; //修改权限



    protected $rule = [
        'id' => 'require|number',
        'name' => 'require|max:32',
        'desc' => 'require|max:255',
    ];


    protected $message  = [
        'name.require' => '请填写职位名称',
        'name.max' => '职位名称不能超过32个字符',
        'desc.require' => '请填写职位描述',
        'desc.max' => '职位描述不能超过255个字符',

    ];

    protected $scene  = [
       self::SCENE_ADD => ['name', 'desc'],
       self::SCENE_MODIFY => ['name', 'desc'],
       self::SCENE_REMOVE => ['id'],
    ];

}